Full source code website bán hàng thương mại điện tử gần giống shopee
468.898 lượt xem;
1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2 <tr align=center>
3 <td class="title" width="100%">Chi tiết đơn hàng : | 
4 </td>
5 </tr>
6 </table>
7 <?
8 switch ($_GET['action'])
9 {
10 case 'del' :
11 $id = $_GET['id'];
12 $sql = "delete from orderdetail where ordersdetail_id='".$id."'";
13 $result = mysql_query($sql,$con);
14 echo mysql_error();
15 if ($result) echo "<p align=center class='err'>Đã xóa thành công</p>";
16 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
17 break;
18 }
19 ?>
20
21 <?
22 if (isset($_POST['ButDel'])) {
23 $cnt=0;
24 foreach ($_POST['chk'] as $id)
25 {
26 @$result = mysql_query("delete from orderdetail where ordersdetail_id='".$id."'",$con);
27 if ($result) $cnt++;
28 }
29 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
30 }
31 ?>
32 <form method="POST" name="frmList" action="index.php">
33 <input type="hidden" name="act" value="orderdetail">
34 <input type="hidden" name="orderid" value="<? echo $_REQUEST['orderid']; ?>">
35 <?
36 $orderid=$_REQUEST['orderid'];
37 if ($orderid=='') return;
38 $orderinfo=GetOrderInfo($orderid);
39 $cust=GetCustomerInfo($orderinfo['orders_customer_id']);
40 $sql_order=mysql_query("SELECT * FROM orders where orders_id='".$orderid."' ");
41 $row_order=mysql_fetch_assoc($sql_order);
42 ?>
43
44 <TABLE border="0" cellspacing="1" cellpadding="2" width="100%" id="table8">
45
46 <TR>
47 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">Họ và tên :</font></TD>
48 <TD width="6">
49 </TD>
50 <TD nowrap>
51 <font face="Tahoma">
52 <span style="font-size: 8.5pt">
53 <b>
54 <? echo $row_order['orders_name']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
55 </font>
56 </b>
57 </TD>
58 </TR>
59 <TR>
60 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">Công ty :</font></TD>
61 <TD width="6"> </TD>
62 <TD nowrap>
63 <font face="Tahoma">
64 <span style="font-size: 8.5pt">
65 <b>
66 <? echo $row_order['orders_company']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
67 </font>
68 </b>
69 </TD>
70 </TR>
71
72
73 <TR>
74 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">Địa chỉ :</font></TD>
75 <TD width="6">
76 </TD>
77 <TD nowrap>
78 <font face="Tahoma">
79 <span style="font-size: 8.5pt">
80 <b>
81 <? echo $row_order['orders_address']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
82 </font>
83 </b>
84 </TD>
85 </TR>
86
87
88
89
90 <TR>
91 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">Điện thọai
92 :</font></TD>
93 <TD width="6">
94 </TD>
95 <TD nowrap>
96 <font face="Tahoma">
97 <span style="font-size: 8.5pt">
98 <b>
99 <? echo $row_order['orders_phone']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
100 </font>
101 </b>
102 </TD>
103 </TR>
104 <TR>
105 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">E-mail :</font></TD>
106 <TD width="6">
107 </TD>
108 <TD nowrap>
109 <font face="Tahoma">
110 <span style="font-size: 8.5pt">
111 <b>
112 <? echo $row_order['orders_email']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
113 </font>
114 </b>
115 </TD>
116 </TR>
117
118 </TABLE>
119
120 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
121 <tr>
122 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
123 <td colspan="2" nowrap class="title"> </td>
124 <td align="center" nowrap class="title"><b>Mã hàng</b></td>
125 <td align="center" nowrap class="title"><b>Tên hàng</b></td>
126 <td align="center" nowrap class="title"><b>Số lượng</b></td>
127 <td align="center" nowrap class="title"><b>Đơn giá</b></td>
128 <td align="center" nowrap class="title"><b>Thành tiền</b></td>
129 <td align="center" nowrap class="title"><b>Ghi chú</b></td>
130 </tr>
131
132 <?php
133 $page = $_GET["page"];
134 $sql="select * from orderdetail where ordersdetail_ordersid=$orderid order by ordersdetail_id";
135 $result=mysql_query($sql,$con);
136 $i=0;
137 while(($row=mysql_fetch_array($result)))
138 {
139 $i++;
140 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
141 $pro=GetProductInfo($row['ordersdetail_product_id']);
142 ?>
143
144 <tr>
145 <td bgcolor="<? echo $color; ?>" class="smallfont">
146 <p align="center"><input type="checkbox" name="chk[]" value="<? echo $row['ordersdetail_id']; ?>"></td>
147 <td bgcolor="<? echo $color; ?>" class="smallfont">
148 <p align="center">
149 <!--<a href="./?act=product_m&id=<? echo $row['products_id']; ?>&page=<? echo $page?>">Edit</a></td>-->
150 <td bgcolor="<? echo $color; ?>" class="smallfont">
151 <p align="center">
152 <a onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" href="./?act=orderdetail&action=del&orderid=<? echo $orderid; ?>&id=<? echo $row['ordersdetail_id']; ?>">Delete</a></td>
153 <td bgcolor="<? echo $color; ?>" align="center" class="smallfont"><? echo $pro['id']; ?> </td>
154 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $pro['name']; ?> </td>
155 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['ordersdetail_quantity']; ?> </td>
156 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo number_format($row['ordersdetail_price']); ?> </td>
157 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo number_format($row['ordersdetail_quantity']*$row['ordersdetail_price']); ?> </td>
158 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row_order['ghichu']; ?> </td>
159 </tr>
160 <?
161 }
162 ?>
163 </table>
164 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
165 </form>
166 <script language="JavaScript">
167 function chkallClick(o) {
168 var form = document.frmList;
169 for (var i = 0; i < form.elements.length; i++) {
170 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
171 form.elements[i].checked = document.frmList.chkall.checked;
172 }
173 }
174 }
175 </script>
2 <tr align=center>
3 <td class="title" width="100%">Chi tiết đơn hàng : | 
4 </td>
5 </tr>
6 </table>
7 <?
8 switch ($_GET['action'])
9 {
10 case 'del' :
11 $id = $_GET['id'];
12 $sql = "delete from orderdetail where ordersdetail_id='".$id."'";
13 $result = mysql_query($sql,$con);
14 echo mysql_error();
15 if ($result) echo "<p align=center class='err'>Đã xóa thành công</p>";
16 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
17 break;
18 }
19 ?>
20
21 <?
22 if (isset($_POST['ButDel'])) {
23 $cnt=0;
24 foreach ($_POST['chk'] as $id)
25 {
26 @$result = mysql_query("delete from orderdetail where ordersdetail_id='".$id."'",$con);
27 if ($result) $cnt++;
28 }
29 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
30 }
31 ?>
32 <form method="POST" name="frmList" action="index.php">
33 <input type="hidden" name="act" value="orderdetail">
34 <input type="hidden" name="orderid" value="<? echo $_REQUEST['orderid']; ?>">
35 <?
36 $orderid=$_REQUEST['orderid'];
37 if ($orderid=='') return;
38 $orderinfo=GetOrderInfo($orderid);
39 $cust=GetCustomerInfo($orderinfo['orders_customer_id']);
40 $sql_order=mysql_query("SELECT * FROM orders where orders_id='".$orderid."' ");
41 $row_order=mysql_fetch_assoc($sql_order);
42 ?>
43
44 <TABLE border="0" cellspacing="1" cellpadding="2" width="100%" id="table8">
45
46 <TR>
47 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">Họ và tên :</font></TD>
48 <TD width="6">
49 </TD>
50 <TD nowrap>
51 <font face="Tahoma">
52 <span style="font-size: 8.5pt">
53 <b>
54 <? echo $row_order['orders_name']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
55 </font>
56 </b>
57 </TD>
58 </TR>
59 <TR>
60 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">Công ty :</font></TD>
61 <TD width="6"> </TD>
62 <TD nowrap>
63 <font face="Tahoma">
64 <span style="font-size: 8.5pt">
65 <b>
66 <? echo $row_order['orders_company']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
67 </font>
68 </b>
69 </TD>
70 </TR>
71
72
73 <TR>
74 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">Địa chỉ :</font></TD>
75 <TD width="6">
76 </TD>
77 <TD nowrap>
78 <font face="Tahoma">
79 <span style="font-size: 8.5pt">
80 <b>
81 <? echo $row_order['orders_address']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
82 </font>
83 </b>
84 </TD>
85 </TR>
86
87
88
89
90 <TR>
91 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">Điện thọai
92 :</font></TD>
93 <TD width="6">
94 </TD>
95 <TD nowrap>
96 <font face="Tahoma">
97 <span style="font-size: 8.5pt">
98 <b>
99 <? echo $row_order['orders_phone']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
100 </font>
101 </b>
102 </TD>
103 </TR>
104 <TR>
105 <TD align="right" width="100"><font color="#000000" style="font-size: 8.5pt">E-mail :</font></TD>
106 <TD width="6">
107 </TD>
108 <TD nowrap>
109 <font face="Tahoma">
110 <span style="font-size: 8.5pt">
111 <b>
112 <? echo $row_order['orders_email']; ?></b></span></font><b><font color="#000000" style="font-size: 8.5pt">
113 </font>
114 </b>
115 </TD>
116 </TR>
117
118 </TABLE>
119
120 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
121 <tr>
122 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
123 <td colspan="2" nowrap class="title"> </td>
124 <td align="center" nowrap class="title"><b>Mã hàng</b></td>
125 <td align="center" nowrap class="title"><b>Tên hàng</b></td>
126 <td align="center" nowrap class="title"><b>Số lượng</b></td>
127 <td align="center" nowrap class="title"><b>Đơn giá</b></td>
128 <td align="center" nowrap class="title"><b>Thành tiền</b></td>
129 <td align="center" nowrap class="title"><b>Ghi chú</b></td>
130 </tr>
131
132 <?php
133 $page = $_GET["page"];
134 $sql="select * from orderdetail where ordersdetail_ordersid=$orderid order by ordersdetail_id";
135 $result=mysql_query($sql,$con);
136 $i=0;
137 while(($row=mysql_fetch_array($result)))
138 {
139 $i++;
140 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
141 $pro=GetProductInfo($row['ordersdetail_product_id']);
142 ?>
143
144 <tr>
145 <td bgcolor="<? echo $color; ?>" class="smallfont">
146 <p align="center"><input type="checkbox" name="chk[]" value="<? echo $row['ordersdetail_id']; ?>"></td>
147 <td bgcolor="<? echo $color; ?>" class="smallfont">
148 <p align="center">
149 <!--<a href="./?act=product_m&id=<? echo $row['products_id']; ?>&page=<? echo $page?>">Edit</a></td>-->
150 <td bgcolor="<? echo $color; ?>" class="smallfont">
151 <p align="center">
152 <a onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" href="./?act=orderdetail&action=del&orderid=<? echo $orderid; ?>&id=<? echo $row['ordersdetail_id']; ?>">Delete</a></td>
153 <td bgcolor="<? echo $color; ?>" align="center" class="smallfont"><? echo $pro['id']; ?> </td>
154 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $pro['name']; ?> </td>
155 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['ordersdetail_quantity']; ?> </td>
156 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo number_format($row['ordersdetail_price']); ?> </td>
157 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo number_format($row['ordersdetail_quantity']*$row['ordersdetail_price']); ?> </td>
158 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row_order['ghichu']; ?> </td>
159 </tr>
160 <?
161 }
162 ?>
163 </table>
164 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button">
165 </form>
166 <script language="JavaScript">
167 function chkallClick(o) {
168 var form = document.frmList;
169 for (var i = 0; i < form.elements.length; i++) {
170 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
171 form.elements[i].checked = document.frmList.chkall.checked;
172 }
173 }
174 }
175 </script>